noteOp

open fun noteOp(@NonNull context: @NonNull Context, @NonNull op: @NonNull String, uid: Int, @NonNull packageName: @NonNull String): Int(source)

Make note of an application performing an operation. Note that you must pass in both the uid and name of the application to be checked; this function will verify that these two match, and if not, return MODE_IGNORED. If this call succeeds, the last execution time of the operation for this app will be updated to the current time.

Compatibility

  • On API 18 and lower, this method always returns MODE_IGNORED

Return

Returns MODE_ALLOWED if the operation is allowed, or MODE_IGNORED if it is not allowed and should be silently ignored (without causing the app to crash).

Parameters

context

Your context.

op

The operation to note. One of the OPSTR_* constants.

uid

The user id of the application attempting to perform the operation.

packageName

The name of the application attempting to perform the operation.

Throws

If the app has been configured to crash on this op.